package me.zhengjie.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.pojo.dto.ArtificialInboundDto;
import me.zhengjie.pojo.dto.PdaPointToPointCallCarDto;
import me.zhengjie.pojo.dto.SortingResultDto;
import me.zhengjie.pojo.vo.ReturnVo;
import me.zhengjie.service.PdaService;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/pda")
@RequiredArgsConstructor
@Api(tags = "wcsPda接口")
public class PdaController {

    private final PdaService pdaService;

    //pda库外储位释放
    @ApiOperation("pda库外储位释放")
    @PostMapping("/storage/release")
    public ReturnVo pdaStorageRelease(@RequestBody String storage){
        ReturnVo returnVo = pdaService.pdaStorageRelease(storage);
        return returnVo;
    }


    //pda点对点叫车
    @ApiOperation("点对点叫车")
    @PostMapping("/pointToPoint/call")
    public ReturnVo pdaPointToPointCallCar(@RequestBody PdaPointToPointCallCarDto pdaPointToPointCallCarDto){
        boolean b = pdaService.pdaPointToPointCallCar(pdaPointToPointCallCarDto);
        if (b){
            return ReturnVo.OK();
        }
        return ReturnVo.ng("叫车失败");
    }

//    //1楼回库
//    @ApiOperation("1楼回库")
//    @GetMapping("/circle/library")
//    public ReturnVo circleLibrary(@RequestBody String storageCode){
//        ReturnVo returnVo = pdaService.circleLibrary(storageCode);
//        return returnVo;
//    }

    //载具码检测嵌套信息
    @GetMapping("/vehicle/nesting")
    @ApiOperation("载具码检测嵌套信息")
    public ReturnVo vehicleNesting(@RequestParam("containerCode") String containerCode){
        ReturnVo returnVo = pdaService.vehicleNesting(containerCode);
        return returnVo;
    }


    //人工入庫
    @ApiOperation("人工入庫")
    @PostMapping("/artificial/inbound")
    public ReturnVo artificialInbound(@RequestBody ArtificialInboundDto artificialInboundDto){
        ReturnVo returnVo = pdaService.artificialInbound(artificialInboundDto);
        return returnVo;
    }
}
